package de.tum.beilmeiner.im.client.view;

import com.google.gwt.user.client.rpc.IsSerializable;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.LayoutPanel;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.VerticalPanel;

import de.tum.beilmeiner.im.client.controller.ChatRoomController;
import de.tum.beilmeiner.im.shared.model.ChatRoom;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.cellview.client.CellList;
import de.tum.beilmeiner.im.shared.model.InstantMessage;
import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.cell.client.Cell.Context;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.TextBox;

public class ChatRoomWindow extends LayoutPanel {

	private TextBox sendBox = null;
	private Button sendButton = null;
	
	
	public ChatRoomWindow(ChatRoom chatRoom) {
		
		sendButton = new Button("Senden");
		add(sendButton);
		setWidgetLeftWidth(sendButton, 345.0, Unit.PX, 81.0, Unit.PX);
		setWidgetTopHeight(sendButton, 254.0, Unit.PX, 30.0, Unit.PX);
		
		sendBox = new TextBox();
		add(sendBox);
		setWidgetLeftWidth(sendBox, 37.0, Unit.PX, 284.0, Unit.PX);
		setWidgetTopHeight(sendBox, 250.0, Unit.PX, 34.0, Unit.PX);
		
		CellList<InstantMessage> cellList = new CellList<InstantMessage>(new AbstractCell<InstantMessage>(){
			@Override
			public void render(Context context, InstantMessage value, SafeHtmlBuilder sb) {
				// TODO
			}
		});
		add(cellList);
		setWidgetLeftWidth(cellList, 37.0, Unit.PX, 284.0, Unit.PX);
		setWidgetTopHeight(cellList, 42.0, Unit.PX, 202.0, Unit.PX);
		
	}

	public void addSendButtonListener(ChatRoomController chatRoomController) {
		sendButton.addClickHandler(chatRoomController);
		
	}
}
